package com.baixun.gassystem.mapper;

import com.baixun.gasentity.vo.AbnormalPointVo;
import com.baixun.gasentity.vo.NormalPointVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @program: 上海燃气驾驶舱
 * @description: 异常点位
 * @author: yesong
 **/
public interface AbnormalPointMapper extends BaseMapper<AbnormalPointVo> {


 /**
  * 查询所有异常点位
  * @return 异常点位列表
  */
 @Select("SELECT point_status AS eventStatus, pointId AS pointId, pointName AS pointName " +
         "FROM sys_point WHERE point_status = 'OFFLINE'")
 List<AbnormalPointVo> getAllAbnormalPoints();


 /**
  * 查询所有非异常点位
  * @return 异常点位列表
  */
 @Select("SELECT point_status AS eventStatus, pointId AS pointId, pointName AS pointName " +
         "FROM sys_point WHERE point_status = 'ONLINE'")
 List<NormalPointVo> getAllNormallPoints();
 /**
  * 根据标签查询异常点位
  * @param tag 标签
  * @return 异常点位列表
  */

 @Select("SELECT point_status AS eventStatus, pointId AS pointId, pointName AS pointName " +
         "FROM sys_point WHERE point_status= 'OFFLINE' AND JSON_UNQUOTE(JSON_EXTRACT(tags, '$[*].tagNames')) = #{tag}")
 List<AbnormalPointVo> getAbnormalPointsByTag(@Param("tag") String tag);



}
